﻿#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace Character.Jarily {
    [CustomEditor(typeof(Chain))]
    public class ChainEditor : Editor
    {
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            Chain cha = target as Chain;
            if (GUILayout.Button("Add a Point", GUILayout.Height(20f)))
            {
                GameObject ngo = new GameObject("Point" + "[" + cha.Point.Count+"]");
                ngo.transform.position = cha.Point == null ? cha.Point[cha.Point.Count -1].position:cha.transform.position;
                ngo.transform.parent = cha.transform;
                cha.Point.Add(ngo.transform);
            }
            if (GUILayout.Button("imformation"))
            {
                foreach (Transform x in cha.Point)
                    Debug.Log(x.GetInstanceID());
            }
        }
    }
}
#endif